package com.winit.schedule.task.tracker.conf;

import com.winit.schedule.core.conf.Configuration;

/**
 * 获取配置
 * 
 * @author jianke.zhang 2015-3-16 上午9:57:48
 * @since 1.0
 */
public class TaskConfiguration extends com.winit.schedule.core.conf.JobConfiguration {

    public static final String  TASK_TRACKER_CONFIG_FILE = "uschedule-conf.properties";

    /**
     * 是否开启task tracker
     */
    public static final String  USCHEDULE_ENABLE         = USCHEDULE_PREFIX + "enable";

    /**
     * task tracker默认为开启状态
     */
    public static final boolean DEFAULT_USCHEDULE_ENABLE = true;

    /**
     * Job Tracker configs
     */
    public static final String  JT_RREFIX                = USCHEDULE_PREFIX + "job.tracker.";

    /**
     * Job Tracker 服务器地址
     */
    public static final String  JT_ADDRESS               = JT_RREFIX + "address";

    /**
     * Job Tracker 端口号
     */
    public static final String  DEFAULT_JT_PORT          = "8019";

    /**
     * Job Tracker 默认地址
     */
    public static final String  DEFAULT_JT_ADDRESS       = "0.0.0.0:" + DEFAULT_JT_PORT;

    /**
     * taskTracker任务分组
     */
    public static final String  JT_TASK_GROUP            = USCHEDULE_PREFIX + "task.group";

    public static final String  DEFAULT_JT_TASK_GROUP    = "default-group";

    /**
     * 任务排除
     */
    public static final String  JT_TASK_EXCLUDE          = USCHEDULE_PREFIX + "task.exclude";

    public static final String  DEFAULT_JT_TASK_EXCLUDE  = "";

    /**
     * 支持的最大线程数(暂未实现)
     */
    public static final String  JT_MAX_THREADS           = USCHEDULE_PREFIX + "max.threads";

    public static final int     DEFAULT_JT_MAX_THREADS   = 0;

    /**
     * 远程过程调用失败重试次数
     */
    public static final String  RPC_RETRY_TIMES          = USCHEDULE_PREFIX + "rpc.retry.times";

    /**
     * 远程过程调用失败默认重试次数，默认10次
     */
    public static final int     DEFAULT_RPC_RETRY_TIMES  = 10;

    /**
     * taskTracker UUID生成需要的随机数，默认值为空字符串，当在同一台服务器上部署TaskTracker生成UUID重复时使用,值可随意设置
     */
    public static final String  UUID_RANDOM              = USCHEDULE_PREFIX + "uuid.random";

    public static final String  DEFAULT_UUID_RANDOM      = "";

    static {
        // Configuration.addClassPathResource(TaskConfiguration.TASK_TRACKER_CONFIG_FILE);
    }

    public TaskConfiguration(){
        super();
    }

    public TaskConfiguration(Configuration conf){
        super(conf);
        if (!(conf instanceof TaskConfiguration)) {
            this.reloadConfiguration();
        }
    }

}
